{extend name='admin@main'}
{block name="content"}
<form onsubmit="return false;" id="DrawFrom" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
    <div class="layui-card-body padding-left-40">
        <div class="layui-form-item layui-row layui-col-space15">
            <label class="layui-col-xs3 relative">
                <span class="color-green">奖品名称</span>
                <input name="title_zh_cn"  class="layui-input" placeholder="请输入奖品名称" value="{$vo.title_zh_cn|default=''}">
            </label>
        </div>
        <div class="layui-form-item layui-row layui-col-space15">
            <label class="layui-col-xs3 relative">
                <span class="color-green">类型</span>
                <select class="layui-select" name="type">
                    {foreach ['1'=>'实物','2'=>'现金','3'=>'未中奖'] as $k=>$v}
                    <!--{eq name='$vo.type' value='$k.""'}-->
                    <option selected value="{$k}">{$v}</option>
                    <!--{else}-->
                    <option value="{$k}">{$v}</option>
                    <!--{/eq}-->
                    {/foreach}
                </select>
            </label>
            <label class="layui-col-xs3 relative">
                <span class="color-green">奖励金额(非现金不用填)</span>
                <input name="money" class="layui-input" placeholder="请输入现金奖励金额" value="{$vo.money|default='0'}">
            </label>
            <label class="layui-col-xs3 relative">
                <span class="color-green">中奖概率</span>
                <input name="probability" class="layui-input" placeholder="请输入中奖概率" value="{$vo.probability|default='0'}">
            </label>
        </div>
        <div class="layui-form-item layui-row layui-col-space15">
            <span class="color-green label-required-prev">奖品图片</span>
            <table class="layui-table">
                <thead>
                <tr>
                    <th class="text-center">比例 1：1</th>
                </tr>
                <tr>
                    <td width="150px" class="text-center">
                        <input name="img" type="hidden" value="{$vo.img|default=''}">
                    </td>
                </tr>
                </thead>
            </table>
            <script>$('[name="img"]').uploadOneImage()</script>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" type="button">取消编辑</button>
    </div>
</form>
{/block}
{block name='script'}
<script>
    window.form.render();
    require(['angular'], function () {
        var app = angular.module("DrawFrom", []).run(callback);
        angular.bootstrap(document.getElementById(app.name), [app.name]);
        function callback($rootScope) {
            $rootScope.hsitoryBack = function () {
                $.msg.confirm('确定要取消编辑吗？', function (index) {
                    history.back(), $.msg.close(index);
                });
            };
        }

    })
</script>
{/block}
